<template>
  <div class="coursebody">
    <div class="lesson_article_body">
      <div class="lesson_article_item" v-for="(item, k) in info.banner" :key="k">
        <div class="lesson_article_img">
          <img :src="$fnc.getImgUrl(item.piclink)" alt="" />
        </div>
        <div class="lesson_article_content">
          <p>{{ item.title }}</p>
          <p>
            {{ $fnc.toFixedZ(item.price || "xx") }}元
            <span>{{ item.hit || "0" }}人最近报名 </span>
          </p>
        </div>
      </div>
    </div>
  </div>
</template>
<script>
export default {
  data () {
    return {};
  },
  props: {
    info: {
      type: Object,
      default: () => ({})
    }
  },
  components: {},
  methods: {
    get_int_dec (num, type) {
      // @type  int-整数部分 ,dec - 小数部分
      num = num + "";
      num = num.toString();
      var decimal = 2;
      decimal = decimal >= 2 && decimal < 6 ? 2 : decimal;
      decimal = decimal == "0" ? 0 : decimal || 2;
      let index = num.indexOf(".");
      if (index !== -1) {
        num = num.substring(0, decimal + index + 1);
      } else {
        num = num.substring(0);
      }
      num = parseFloat(num).toFixed(decimal);
      if (type == "int") {
        return parseInt(num);
      } else if (type == "dec") {
        return "." + num.toString().split(".")[1] || ".00";
      }
    }
  }
};
</script>
<style lang="less" scoped>
.coursebody {
  width: 100%;
  margin: 0 auto;
  background-color: #fff;
  padding: 10px 0;
}
.lesson_article_body {
  width: 94%;
  margin: 0 auto;
  display: flex;
  flex-flow: column;
  justify-content: flex-start;
  align-items: flex-start;
  // padding: 15px 13px 0 13px;
}

.lesson_article_item {
  width: 100%;
  height: 75px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 15px;
  .lesson_article_img {
    width: 45%;
    display: flex;
    justify-content: center;
    align-items: center;
    img {
      width: 100%;
      height: 75px;
      border-radius: 5px;
    }
  }
  .lesson_article_content {
    width: 52%;
    height: 100%;
    display: flex;
    flex-flow: column;
    justify-content: space-between;
    align-items: flex-start;
    p:nth-of-type(1) {
      font-size: 14px;
      color: #000000;
      line-height: 20px;
      text-align: justify;
      display: -webkit-box;
      -webkit-box-orient: vertical;
      -webkit-line-clamp: 2;
      overflow: hidden;
    }
    p:nth-of-type(2) {
      font-size: 14px;
      font-weight: bold;
      color: #ea6c2b;
      line-height: 20px;
      text-align: left;
      span {
        font-size: 12px;
        color: #626262;
        font-weight: normal;
        padding-left: 10px;
      }
    }
  }
}
</style>
